//
//  UIButton+Extension.swift
//  fushp_weibo
//
//  Created by fushp on 2017/11/12.
//  Copyright © 2017年 fushp. All rights reserved.
//

import UIKit
extension UIButton {
    //自定义初始化方法
    convenience init (imageName : String ,bgImageName : String) {
        self.init()
        
        setImage(UIImage(named: imageName), for: .normal)
        setImage(UIImage(named: imageName + "_highlighted"), for: .highlighted)
        setBackgroundImage(UIImage(named: bgImageName), for: .normal)
        setBackgroundImage(UIImage(named: bgImageName + "_highlighted"), for: .highlighted)
        sizeToFit()
    }
    convenience init(bgColor : UIColor, fontSize : CGFloat, title : String) {
        self.init()
        
        setTitle(title, for: .normal)
        backgroundColor = bgColor
        titleLabel?.font = UIFont.systemFont(ofSize: fontSize)
    }
    convenience init( title : String,fontSize : CGFloat,normalColor : UIColor,highlightedColor: UIColor   ) {
        self.init()
        setTitle(title, for: .normal)
        titleLabel?.font = UIFont.systemFont(ofSize: fontSize)
       setTitleColor(normalColor, for: .normal)
        setTitleColor(highlightedColor, for: .highlighted)
        sizeToFit()

    }
    
}
